App({
    globalData: {
        userInfo: null,
        rande: 1
    },
    util: require("we7/resource/js/util.js"),
    siteInfo: require("siteinfo.js"),
    onLaunch: function() {},
    getUserInfo: function(n) {
        var o = this;
        wx.login({
            success: function(e) {
                o.util.request({
                    url: "entry/wxapp/Openid",
                    cachetime: "0",
                    data: {
                        code: e.code
                    },
                    success: function(e) {
                        console.log(e), getApp().session_key = e.data.session_key, getApp().OpenId = e.data.openid, 
                        getApp().getSK = e.data.session_key;
                        var t = e.data.openid;
                        wx.getSetting({
                            success: function(e) {
                                1 != e.authSetting["scope.userInfo"] ? (console.log("检测到用户没有授权"), o.util.request({
                                    url: "entry/wxapp/login",
                                    cachetime: "0",
                                    data: {
                                        openid: t,
                                        img: "",
                                        name: ""
                                    },
                                    success: function(e) {
                                        getApp().getuniacid = e.data.uniacid, getApp().user_info = e.data, wx.setStorageSync("userInfo", e.data), 
                                        n(e.data);
                                    }
                                })) : (console.log("检测到用户已经授权 "), wx.getUserInfo({
                                    withCredentials: !1,
                                    success: function(e) {
                                        o.util.request({
                                            url: "entry/wxapp/login",
                                            cachetime: "0",
                                            data: {
                                                openid: t,
                                                img: e.userInfo.avatarUrl,
                                                name: e.userInfo.nickName
                                            },
                                            success: function(e) {
                                                getApp().getuniacid = e.data.uniacid, getApp().user_info = e.data, wx.setStorageSync("userInfo", e.data), 
                                                n(e.data);
                                            }
                                        });
                                    }
                                }));
                            }
                        });
                    }
                });
            }
        });
    },
    max: function(e) {
        e = e[0];
        for (var t = e.length, n = 1; n < t; n++) e[n] > e && (e = e[n]);
        return e;
    },
    today_time: function(e) {
        var t = new Date(), n = t.getMonth() + 1, o = t.getDate();
        return 1 <= n && n <= 9 && (n = "0" + n), 0 <= o && o <= 9 && (o = "0" + o), t.getFullYear() + "-" + n + "-" + o + " " + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds();
    },
    hours_time: function(e, t) {
        var n = new Date(e.replace("-", "/")), o = 60 * (t = Number(t));
        return n.setMinutes(n.getMinutes() + o, n.getSeconds(), 0), n.getFullYear() + "-" + (n.getMonth() + 1) + "-" + n.getDate() + " " + n.getHours() + ":" + n.getMinutes() + ":" + n.getSeconds();
    },
    today: function() {
        var e = new Date(), t = e.getFullYear(), n = e.getMonth() + 1, o = e.getDate();
        return 1 <= n && n <= 9 && (n = "0" + n), 0 <= o && o <= 9 && (o = "0" + o), t + "-" + n + "-" + o;
    },
    ormatDate: function(e) {
        var t = new Date(1e3 * e);
        return t.getFullYear() + "-" + n(t.getMonth() + 1, 2) + "-" + n(t.getDate(), 2) + " " + n(t.getHours(), 2) + ":" + n(t.getMinutes(), 2) + ":" + n(t.getSeconds(), 2);
        function n(e, t) {
            for (var n = "" + e, o = n.length, a = "", r = t; r-- > o; ) a += "0";
            return a + n;
        }
    },
    sort_price_Reverse: function(e, t) {
        return e.zd_money - t.zd_money;
    },
    sort_price_order: function(e, t) {
        return t.zd_money - e.zd_money;
    },
    sort_num_order: function(e, t) {
        return e - t;
    },
    sort_distance_order: function(e, t) {
        return e.distance - t.distance;
    },
    sort_distance_Reverse: function(e, t) {
        return t.distance - e.distance;
    },
    time_title: function(e, t) {
        return !(t <= e) || (wx.showModal({
            title: "",
            content: "时间选择错误"
        }), !1);
    },
    getTime2Time: function(e, t) {
        e = e, t = t;
        return ((e = Date.parse(e) / 1e3) - (t = Date.parse(t) / 1e3)) / 86400;
    },
    getSys: function() {
        var t = this;
        wx.getSystemInfo({
            success: function(e) {
                t.globalData.sysInfo = e, t.globalData.windowW = e.windowWidth, t.globalData.windowH = e.windowHeight;
            }
        });
    }
});